<template>
  <div>
    <div class="bbox">
      <div class="header">
        <slot name="header"></slot>
        <!-- 插槽内容 -->
        <!-- <h3>新书抢鲜 <span>24小时热销新书</span></h3>
        <div class="more">
          更多<span class="iconfont icon-arrow-right-"></span>
        </div> -->
      </div>
      <div class="con_newbook">
        <div class="ul">
          <li v-for="(item,index) in data" :key="index" @click="gotoDetails('details', { id: item._id })">
            <div class="imgs">
              <img :src="item.cover | imgUrl" alt="" />
            </div>
            <div class="text">
              <p class="name">{{item.title}}</p>
              <p class="introduce">
                {{item.shortIntro}}
              </p>
              <p class="info">
                <span class="iconfont icon-icon-12">{{item.author}}</span>
                <span><em>{{item.majorCate || item.cat}}</em><em>连载中</em><em>93.64万字</em></span>
              </p>
            </div>
          </li>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  methods: {
    gotoDetails(path, params) {
      this.$router.push({
        path: `/${path}`,
        query: { ...params },
      });
    },
  },
  computed: {
    gender() {
      return this.$store.state.ismale;
    },
  },
  props: ["data"],
  filters: {
    imgUrl(url) {
      if (url) {
        return "http://statics.zhuishushenqi.com" + url;
      } else {
        return "";
      }
    },
  },
};
</script>

<style lang="less" scoped>
.bbox {
  padding: 0.46875rem;
  padding-bottom: 0;
  background-color: white;
  .header {
    border-left: 2.5px solid #ed424b;
    text-indent: 8px;
    position: relative;
    h3 {
      font-family: "宋体";
      font-weight: 600;
      font-size: 0.390625rem;
      position: relative;
      span {
        font-size: 0.34375rem;
        color: #777;
        font-weight: normal;
        vertical-align: botto;
      }
    }
    .more {
      // 更多
      font-size: 0.375rem;
      color: #777;
      position: absolute;
      right: 0;
      top: 0;
      span {
        margin-left: 0.15625rem;
      }
    }
  }
  .con_newbook {
    .ul {
      li {
        padding: 0.46875rem 0;
        display: flex;
        border-bottom: 1px solid #ddd;
        &:last-child {
          border-bottom: none;
        }
        .imgs {
          flex: 0 0 1.875rem;
          img {
            width: 100%;
            height: 100%;
          }
        }
        .text {
          flex: 1;
          padding: 0 0.15625rem;
          position: relative;
          .name {
            font-size: 0.46875rem;
            font-weight: bolder;
            // 溢出显示省略号
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 1;
            line-clamp: 1;
            -webkit-box-orient: vertical;
          }
          .introduce {
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            line-clamp: 2;
            -webkit-box-orient: vertical;
            font-size: 0.390625rem;
            color: #777;
            margin-top: 0.3125rem;
          }
          .info {
            position: absolute;
            bottom: 0;
            width: 100%;
            margin-top: 0.15625rem;
            font-size: 0.3125rem;
            span {
              font-size: 0.390625rem;
              color: #777;
              vertical-align: top;
              &:nth-child(2) {
                float: right;
              }
            }
            em {
              font-size: 0.234375rem;
              font-style: normal;
              border: 1px solid #777;
              border-radius: 1px;
              margin-right: 0.09375rem;
              &:nth-of-type(2) {
                border-color: #ed424b;
                color: #ed424b;
              }
              &:nth-of-type(3) {
                border-color: #4284ed;
                color: #4284ed;
              }
            }
          }
        }
      }
    }
  }
}
</style>